package com.molyfun.parents.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.molyfun.parents.R;

/**
 * Created by william(liuchao.hit@gmail.com).
 * Date:12/27/16.
 */
public class GuideImageFragment extends Fragment {

    private static final String GUIDE_IMAGE_RES_ID = "guide_image_res_id";
    private static final String GUIDE_COLOR_RES_ID = "guide_color_res_id";
//    private static final String GUIDE_IMAGE_STR_TOP = "guide_text_top";
//    private static final String GUIDE_IMAGE_STR_BOTTOM = "guide_text_bottom";

    private int imageResId;
    private int colorResId;
    private String mTopStr;
    private String mBottomStr;

    public static GuideImageFragment newInstance(int imageResId, int colorId) {
        GuideImageFragment guideImageFragment = new GuideImageFragment();
        Bundle bundle = new Bundle();
        bundle.putInt(GUIDE_IMAGE_RES_ID, imageResId);
        bundle.putInt(GUIDE_COLOR_RES_ID, colorId);
        guideImageFragment.setArguments(bundle);
        return guideImageFragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        imageResId = getArguments().getInt(GUIDE_IMAGE_RES_ID, -1);
        colorResId = getArguments().getInt(GUIDE_COLOR_RES_ID, -1);
//        mTopStr = getArguments().getString(GUIDE_IMAGE_STR_TOP);
//        mBottomStr = getArguments().getString(GUIDE_IMAGE_STR_BOTTOM);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_image_guide, container, false);
        ImageView guideIV = (ImageView) view.findViewById(R.id.guide_image);
        guideIV.setImageResource(imageResId);
        view.setBackgroundResource(colorResId);
        return view;
    }

}
